<?php

namespace App\Providers;
use App\Model\Config;
use App\Observers\ConfigObserver;
use App\Server\TagServer;
use Houdunwang\Aliyun\Aliyun;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot(TagServer $tagServer)
    {
        //如果你是在版本低于 5.7.7 的 MySQL 上创建索引那就需要你手动配置迁移生成的默认字符串长度。
        Schema::defaultStringLength(191);
        $this->loadConfig();
       Config::observe(ConfigObserver::class);
        \Carbon\Carbon::setLocale('zh');
        $tagServer->make();
    }
    protected function loadConfig ()
    {
        Aliyun::config ( [
            'regionId'  => \config ('aliyun.accessId') ,
            'accessId'  => \config ('aliyun.accessId') ,
            'accessKey' => \config ('aliyun.accessKey') ,
        ] );
    }
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        if ($this->app->environment() !== 'production') {
            $this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
        }
    }
}
